package org.example.api.user;

import org.example.controller.CommonResponse;
import org.example.entity.dto.AuthorDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Primary;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author Aaron
 * @since 2020/12/25 16:15
 * <p>描述：</p>
 */
@Primary
@FeignClient(value = "microservice-example-ms", path = "/author",
        fallback = FeignAuthorServiceImpl.class)
public interface FeignAuthorService {

    @PostMapping("/save")
    CommonResponse<Integer> saveAuthor(@RequestBody AuthorDTO authorDTO);

    @DeleteMapping("/{userId}")
    CommonResponse<Integer> deleteAuthorById(@PathVariable("userId") Long userId);

    @PutMapping("/update")
    CommonResponse<Integer> updateAuthorById(@RequestBody AuthorDTO authorDTO);

    @GetMapping("/getAuthorById")
    CommonResponse<AuthorDTO> getAuthorById(@RequestParam("id") Long id);

    @RequestMapping(value = "/listAuthors", method = RequestMethod.GET)
    CommonResponse<List<AuthorDTO>> listAuthors(AuthorDTO authorDTO);

}
